Skip to content

Canonicalize test units with @safetestset#86

Closed
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:canonicalize-safetestset
Closed

Canonicalize test units with @safetestset#86
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:canonicalize-safetestset

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Contributor

What

Wraps each independent test unit in its own @safetestset so it runs in a fresh module — giving isolation between tests and world-age safety, matching the canonical OrdinaryDiffEq test structure.

Core (test/runtests.jl else-branch)

  • The three sampler distribution loops + the test_samples helper they share moved into a self-contained test/sampler_tests.jl, wrapped in @safetestset "Sampler distribution tests".
  • @testset "BigFloat support" -> test/bigfloat_tests.jl.
  • @testset "PassthroughRNG dispatch" -> test/passthrough_rng_tests.jl.
  • @testset "Allocation Tests" keeps including alloc_tests.jl, now via @safetestset.

Each extracted file carries its own using/import lines so the body is self-contained inside its fresh module.

QA (test/qa/qa.jl)

The Aqua / JET static analysis / ExplicitImports plain @testset blocks become @safetestsets, each including a self-contained file (qa_aqua.jl / qa_jet.jl / qa_explicitimports.jl). The include() form is used so using JET runs before the qualified JET.@test_opt / JET.@test_call macros are reached (avoids the macro-not-yet-defined expansion order issue).

Behavior preserved

  • Same tests run under the same GROUP; GROUP dispatch ladder untouched.
  • No assertions changed; only units wrapped + made self-contained.
  • Adds SafeTestsets to the main test deps and to the QA env (test/qa/Project.toml, which is activated separately).

Verification

Verified locally with Julia 1.11:

  • GROUP=Core — all units pass (BigFloat 401, PassthroughRNG 5, Allocation 10; Sampler block runs, reports 0 @tests because it uses error()-based checks exactly as before).
  • GROUP=QA — Aqua 10, JET 6, ExplicitImports 2, all pass.

Ignore until reviewed by @ChrisRackauckas.

🤖 Generated with Claude Code

Wrap each independent test unit in its own `@safetestset` so it runs in
a fresh module (isolation between tests + world-age safety), matching
the canonical OrdinaryDiffEq structure.

Core (runtests.jl else-branch):
  - The sampler distribution loops + their `test_samples` helper moved
    into a self-contained test/sampler_tests.jl, wrapped in
    `@safetestset "Sampler distribution tests"`.
  - `@testset "BigFloat support"` -> test/bigfloat_tests.jl.
  - `@testset "PassthroughRNG dispatch"` -> test/passthrough_rng_tests.jl.
  - `@testset "Allocation Tests"` keeps including alloc_tests.jl, now
    via `@safetestset`.
Each extracted file carries its own `using`/`import` lines.

QA (test/qa/qa.jl): the Aqua / JET / ExplicitImports plain `@testset`
blocks become `@safetestset`s, each including a self-contained file
(qa_aqua.jl / qa_jet.jl / qa_explicitimports.jl). The include() form is
used so `using JET` runs before the qualified `JET.@test_opt`/`@test_call`
macros are reached.

The GROUP dispatch ladder and all assertions are unchanged. Adds
SafeTestsets to the main test deps and to the QA env (test/qa/Project.toml,
which is activated separately).

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Contributor Author

Superseded by the v1.2 folder conversion on sciml-testing-rollout (#85).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants